﻿@model ProgressTracker.WebUI.Models.Task.IndexViewModel

@{
    ViewBag.Title = "Current Tasks";
}

@if (!Html.ViewData.ModelState.IsValid)
{
    <div class="alert alert-danger">
        @Html.ValidationSummary()
    </div>
}

<table class="table table-bordered table-striped">
    <thead>
        <tr>
            <th>Name</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var task in Model.CurrentTasks)
        {
            <tr>
                <td>@task.Name</td>
                <td>@task.Description</td>
                <td>
                    <button class="btn btn-warning taskEdit" data-edit-url="@Url.Action("Edit", new { id = task.Id })">
                        <span class="glyphicon glyphicon-pencil"></span>
                    </button>
                    <a href="@Url.Action("Archive", new { id = task.Id })" class="btn btn-danger"><span class="glyphicon glyphicon-remove-circle"></span></a>
                </td>
            </tr>
        }
    </tbody>
</table>
<button class="btn btn-primary" id="addTaskBtn" data-add-url="@Url.Action("Add")">Add New Task</button>

<div class="modal fade" id="addModal" aria-hidden="true"></div>

<div class="modal fade" id="editModal" aria-hidden="true"></div>
<script src="~/Scripts/Task/Index.js"></script>